//
//  TLBeseWebVC.m
//  TLKeepCredit
//
//  Created by mc on 2017/10/17.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "TLBeseWebVC.h"
#import "XBWebView.h"

@interface TLBeseWebVC () {
    NSURL *_currentUrl;
}
@property (weak, nonatomic) IBOutlet XBWebView *webView;

@end

@implementation TLBeseWebVC

- (void)__btnLeftAction{
    if (_isPresent) {
        [self dismissViewControllerAnimated:YES completion:^{
        }];
        return;
    }
    [self popSelf];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initUI];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - 初始化
#pragma mark -
#pragma mark ---初始化UI
-(void)initUI {
    
    [self setLeftCustomerItem];
//    [_webView setHiddenProgress:NO];
    _webView.progressTintColor=UIColorFormRGB_theme;
    
    if (_htmlStr) {
        [_webView loadHTMLString:_htmlStr baseURL:nil] ;
    }else if (_urlStr){
        [_webView loadURL:kURL(_urlStr) withTimeoutInterval:60];
        //        NSURLRequest *request=[NSURLRequest requestWithURL:kURL(_urlStr)];
        //        [_zbyWbView loadRequest:request];
    }
}

-(void)dealloc {
    [_webView removeFromSuperview];
    _webView = nil;
}

//刷新当前url
- (void)wbWebView:(XBWebView *)webView didStartLoadingURL:(NSURL *)URL
{
    _currentUrl = URL;
}

#pragma mark ---重新加载网页
- (void)reloadWeb
{
    [_webView loadURL:_currentUrl withTimeoutInterval:30];
}

@end
